﻿using MD5Hash;
using SmartHotel.DAL;
using SmartHotel.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SmartHotel.BLL
{
    public class MemberBLL
    {

        public MemberBLL(MemberDAL memberDAL)
        {
            MemberDAL = memberDAL;
        }

        public MemberDAL MemberDAL { get; }
        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="member"></param>
        /// <returns></returns>
        public int Add(Member member)
        {
            member.Pwd = member.Pwd.GetMD5(); //给密码加密
            return MemberDAL.Add(member);
        }

        public Member GetMemberByName(string name)
        {
            return MemberDAL.GetMemberByName(name);
        }


        public Member GetMemberById(int id)
        {
            return MemberDAL.GetMemberById(id);
        }

        public int Update(Member member)
        {
            return  MemberDAL.Update(member);
        }
    }
}
